package com.seven.loginencrypt.controller;
import com.seven.loginencrypt.utils.RSAUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
@RestController
public class login {

    @RequestMapping("/login")
    public String login(HttpServletRequest request) throws Exception {

        //获取密码，密码是加密后的密码
        String passwd = request.getParameter("userPsd");
        String name = request.getParameter("userName");
        try {
            //解密
            passwd = RSAUtils.decryptBase64(passwd);
            name = RSAUtils.decryptBase64(name);

            System.out.println("解密后密码："+passwd);
            System.out.println("解密后用户名："+name);
            return "";
        } catch (Exception e) {
            // TODO: handle exception
            e.printStackTrace();
            return "";
        }
    }
}
